package com.lihan.GetSeatInLib.Domain;


import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;
import org.hibernate.internal.util.beans.BeanInfoHelper;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.lihan.GetSeatInLib.Domain.Enums.TableStatus;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;

@Entity
@Table(name = "t_tables")
@ApiModel("书桌数据模型")
@JsonIgnoreProperties(value = {"hibernateLazyInitializer"})
public class LibTable {
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "table_id")
	@ApiModelProperty("书桌id")
	private long ID;
	
	@Column(name = "table_status")
	@ApiModelProperty("书桌状态")
	private TableStatus status;
	
	@Column(name = "table_index",length = 20,unique = true)
	@ApiModelProperty("书桌编号：ABCD什么的,限定一个唯一标志")
	private String TableIndex;
	
	@Column(name = "table_number")
	@ApiModelProperty("书桌座位数量上限")
	private int Seat_Number;
	
	@ApiModelProperty("桌子所属的楼层")
	@ManyToOne(cascade = CascadeType.PERSIST,fetch = FetchType.EAGER)
	@JoinColumn(name="floor_table_id")
	@JsonIgnoreProperties(value = "tables")
	private FloorModel belongFloor;
	
	
	@ApiModelProperty("所属的座位")
	@OneToMany(cascade = CascadeType.PERSIST)
	@JoinColumn(name = "seat_table_id")
	@LazyCollection(LazyCollectionOption.FALSE)
	private Set<SeatModel> seatlist;

	public long getID() {
		return ID;
	}
	
	public void setID(long iD) {
		ID = iD;
	}

	public TableStatus getStatus() {
		return status;
	}

	public void setStatus(TableStatus status) {
		this.status = status;
	}

	public String getTableIndex() {
		return TableIndex;
	}

	public void setTableIndex(String tableIndex) {
		TableIndex = tableIndex;
	}

	public int getSeat_Number() {
		return Seat_Number;
	}

	public void setSeat_Number(int seat_Number) {
		Seat_Number = seat_Number;
	}

	public Set<SeatModel> getSeatlist() {
		return seatlist;
	}

	public void setSeatlist(Set<SeatModel> seatlist) {
		this.seatlist = seatlist;
	}

	public LibTable() {
		
	}

	public LibTable(long iD, TableStatus status, String tableIndex, int seat_Number, Set<SeatModel> seatlist) {
		super();
		ID = iD;
		this.status = status;
		TableIndex = tableIndex;
		Seat_Number = seat_Number;
		this.seatlist = seatlist;
	}
	public FloorModel getBelongFloor() {
		return belongFloor;
	}

	public void setBelongFloor(FloorModel belongFloor) {
		this.belongFloor = belongFloor;
	}
	

}
